﻿using System;
using System.Diagnostics;
using System.Globalization;
using System.Windows.Data;

namespace ttg_internal.Utilities.Common.Converters
{
    /// <summary>
    /// Inverts <see cref="bool" /> value
    /// </summary>
    public class NotConverter : IValueConverter
    {
        /// <summary>
        /// Converts a <paramref name="value" />
        /// </summary>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Debug.Assert(value is bool);
            return !(bool)value;
        }

        /// <summary>
        /// Converts a <paramref name="value" />
        /// </summary>
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Debug.Assert(value is bool);
            return !(bool)value;
        }
    }
}
